package com.sxj.corejava.code06_数组;

/**
 * @author 石小俊
 * @date 2025年01月04日
 */
public class Test02_遍历数组 {

    public static void main(String[] args) {
        int[] nums = {1, 3, 6, 7, 8, 10};
        // 普通for循环
        for (int i = 0; i < nums.length; i++) {
//            System.out.print(nums[i]+" ");
            int num = nums[i];
            System.out.print(num + " ");
        }

        System.out.println();

        // 倒序遍历
        for (int i = nums.length - 1; i >= 0; i--) {
            System.out.print(nums[i] + " ");
        }

        System.out.println();

        // 增强for循环,又称之为foreach循环
        for (int num : nums) {
            System.out.print(num + " ");
        }
    }

}
